<!--根据这个页单独设置样式-->
<style>
    .table-responsive{overflow-x: inherit}
    td{ vertical-align: middle!important;}
    .pagination{ margin:0!important;}
</style>
<script type="text/ng-template" id="adminModalContent.html">
    <div class="modal-header">
        <h3 class="modal-title">管理员{{info.state?'编辑':'添加'}}</h3>
    </div>
    <div class="modal-body">
        <div class="row">
            <div class="col-sm-12">
                <form name="form" class="form-validation">
                    <div class="form-group">
                        <label>名字</label>
                        <input type="text" class="form-control"
                               ng-model="info.name"  required >
                    </div>
                    <div class="form-group">
                        <label>电话</label>
                        <input type="text" class="form-control"
                               placeholder="11位电话号码"
                               ng-model="info.phone"
                               ng-pattern="/^[0-9]{11}$/" required >
                    </div>
                    <div class="form-group">
                        <label>新密码<em class="text-muted">(6-12位)</em><em class="text-muted" ng-show="info.state">不填则不修改</em></label>
                        <input type="password" class="form-control"
                               ng-model="info.password"
                               ng-pattern="/^.{6,12}$/"  required >
                    </div>
                    <div class="form-group">
                        <label>角色</label>
                        <select type="text" class="form-control"
                                ng-model="info.roleId"
                                ng-options = "r.id as r.name for r in sel.role">
                        </select>
                    </div>
                    <div class="form-group">
                        <label>状态</label>
                        <select type="text" class="form-control"
                                ng-model="info.enable"
                                ng-options="r.code as r.info for r in sel.status">
                        </select>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <div class="modal-footer">
        <button class="btn btn-sm btn-danger" ng-click="cancel()">Cancel</button>
        <button class="btn btn-sm btn-success" ng-click="ok()">OK</button>
    </div>
</script>
<div  ng-controller="adminListCtrl">
    <div class="bg-light lter b-b wrapper-md">
        <h1 class="m-n font-thin h3">管理员列表</h1>
    </div>
    <div class="wrapper-md" >
        <div class="panel panel-default">
            <div class="panel-heading">
                <label class="control-label ">管理员列表</label>
                <button class="btn btn-info btn-addon btn-sm pull-right"  ng-click="model.open(0)"><i class="fa fa-plus"></i>添加管理员</button>
            </div>
            <div class="table-responsive">
                <table class="table table-striped  b-t b-light">
                    <thead>
                    <tr>
                        <th>id</th>
                        <th>名字</th>
                        <th>账户</th>
                        <th>角色</th>
                        <th>状态</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr ng-repeat="data in vm.data">
                        <td>{{data.id}}</td>
                        <td>
                            {{data.name}}
                        </td>
                        <td>{{data.phone}}</td>
                        <td><span class=" label bg-primary inline m-t-sm">{{data.role}}</span></td>
                        <td><span class="label" ng-class="{'bg-danger':data.enable==0,'bg-success':data.enable==1}">
                            {{data.enable == '1' ? '正常' : '禁用'}}</span></td>
                        <td>
                            <a class="btn btn-sm btn-primary" ng-click="model.open(1,data)">编辑</a>
                            <a class="btn btn-sm btn-danger" ng-click="deltaU(data.id)">删除</a>
                        </td>
                    </tr>
                    <tr  ng-if="!vm.data.length" class="text-center">
                        <td colspan="6">暂无数据！</td>
                    </tr>
                    </tbody>
                </table>
            </div>
            <footer class="panel-footer">
                <div class="row">
                    <div class="col-sm-2 hidden-xs">
                        <select
                                class="input-sm form-control w-sm inline v-middle"
                                ng-model="placement.selected"
                                ng-options="o as o for o in placement.options"
                                ng-change="placement.changeFn()"
                        >
                        </select>
                        <i style="float: right;padding: 2% 15% 0 0">总计{{vm.page.rowtotal}}</i>
                    </div>
                    <div class="col-sm-10 text-right text-center-xs">
                        <div class="pagination pagination-sm m-t-none m-b-none">
                            <uib-pagination
                                    boundary-links="true"
                                    total-items="vm.page.rowtotal"
                                    max-size="placement.pageSize"
                                    items-per-page="placement.selected"
                                    ng-model="vm.page.currentpage"
                                    ng-change="pageChanged()"
                                    class="pagination-sm"
                                    previous-text="&lsaquo;"
                                    next-text="&rsaquo;"
                                    first-text="&laquo;"
                                    last-text="&raquo;"
                            >
                            </uib-pagination>
                        </div>
                    </div>
                </div>
            </footer>
        </div>
    </div>
</div>
